Thread: invalid conversion from `char*' to `char'

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    151

    invalid conversion from `char*' to `char'

    This is a snippet of code
    Code:
    FROM THE MAIN FUNCTION:
    
    Push(s1,check,line); /*s1 is a structure with elements 	Element *contents;
                                                            int top;
    	                                                int lineST;
                          check is a string array
                          line is an integer */
    
    PUSH FUNCTION ACCESSED FROM ANOTHER C FILE:
    
    void Push(stackST *stackP, char* element, int line)
    {
    
      /* Put information in array; update top. */
      char newelement[20];
      int i=0;
      int length = strlen(element);
      for (i=0;i<=length;i++)
    	newelement[i++]=putchar(*element++);
      newelement[i] = '/0';
     stackP->contents[++stackP->top] = newelement;
      stackP->lineST=line;
    }
    I get the following warning and error for the line marked in bold
    warning: multi-character character constant
    error:invalid conversion from `char*' to `char'

    I have twisted the code a lot. But cant figure the solution to this problem.
    Last edited by Ron; 06-14-2008 at 11:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. invalid char to char conversion?
    By kryptkat in forum Windows Programming
    Replies: 2
    Last Post: 09-27-2007, 05:16 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. invalid conversion from `const char*' to `char'
    By GameGenie in forum C++ Programming
    Replies: 6
    Last Post: 08-01-2005, 05:30 AM
  5. invalid conversion from `char*' to `char'
    By Tommy7 in forum C++ Programming
    Replies: 3
    Last Post: 06-09-2005, 10:45 PM